package com.shanks.framework.mq.service;

import com.shanks.framework.mq.enums.MQZone;
import com.shanks.framework.mq.exception.MQException;
import com.shanks.framework.mq.producer.BaseMQProducer;

/**
 * 生产者管理
 */
public interface ProducerService {

    /**
     * 设置默认生产者
     * @param mqProducer
     */
    void setDefaultProducer(BaseMQProducer mqProducer);

    /**
     * 注册producer
     * @param producerKey
     * @param mqProducer
     */
    void resgisterProducer(String producerKey, BaseMQProducer mqProducer) throws MQException;

    /**
     * 通过producerKey获取生产者
     *
     * @param producerKey
     * @return
     * @throws MQException
     */
    BaseMQProducer getProducer(String producerKey) throws MQException;

    /**
     * 通过producerKey获取生产者
     *
     * @param producerKey
     * @return
     * @throws MQException
     */
    BaseMQProducer getProducerQuietly(String producerKey);

    /**
     * 通过producerKey获取当前泳道
     * @param producerKey
     * @return
     */
    MQZone getZoneByProducerKeyQuietly(String producerKey);
}
